/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.ufc.quixada.adrs.comandos.visit;

import br.ufc.quixada.adrs.interfaces.Comando;
import br.ufc.quixada.adrs.model.Prazo;
import br.ufc.quixada.adrs.service.PrazoService;
import java.util.List;
import java.util.Collections;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 *
 * @author Welligton
 */
public class CmdVisitListarTodosPrazos implements Comando {

    public String executa(HttpServletRequest request, HttpServletResponse response) {

        HttpSession sessao = request.getSession(true);
        PrazoService ps = new PrazoService();

        List<Prazo> prazos = ps.getPrazosSuperioresAData(new Date());

        Collections.sort(prazos, PrazoService.comparadorPorFim);

        sessao.setAttribute("listaTodosPrazos", prazos);
        return "/visit/visit_listar_prazos.jsp";
    }
}
